package cn.anecansaitin.jep.parser.ast.node.expression.literal;

import cn.anecansaitin.jep.Token;
import cn.anecansaitin.jep.TokenType;
import cn.anecansaitin.jep.types.TypeInfo;

public final class FloatLiteral extends Literal {
    private final float value;

    public FloatLiteral(Token floatToken) {
        this(floatToken.value(), floatToken.line(), floatToken.column());
    }

    public FloatLiteral(String value, int line, int column) {
        super(TokenType.FLOAT_LITERAL, TypeInfo.FLOAT, line, column);
        this.value = Float.parseFloat(value);
    }

    public float value() {
        return value;
    }
}